<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<!--<h1 class="mui-title">我的消息</h1>-->
			<button id="oA" style="content: normal;">点我亲爱滴</button>
		</header>
		<div class="mui-content">
			<label id="lb" style="font-size:xx-large;color: red;"></label>

		</div>

		<script>
			var interval, reg = /^\d$/,
				sleep = 10,
				sum = 0;
			onload = function() {
				oA.onclick = function() {
					if(!interval) {
						interval = setInterval(function() {

							var date1 = new Date("2008/12/20,16:00:00"); //开始时间
							var date2 = new Date(); //结束时间
							var date3 = date2.getTime() - date1.getTime() //时间差的毫秒数
							var days = Math.floor(date3 / (24 * 3600 * 1000))
							var leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
							var hours = Math.floor(leave1 / (3600 * 1000))
								//计算相差分钟数
							var leave2 = leave1 % (3600 * 1000) //计算小时数后剩余的毫秒数
							var minutes = Math.floor(leave2 / (60 * 1000))
								//计算相差秒数
							var leave3 = leave2 % (60 * 1000) //计算分钟数后剩余的毫秒数
							var seconds = Math.round(leave3 / 1000)
							document.getElementById("lb").innerHTML = " 距离我们相识： " + days + "天 " + hours + "小时 " + minutes + " 分钟" + seconds + " 秒";
						}, sleep);
						this.innerHTML = "停止";
					} else {
						clearInterval(interval);
						interval = null;
						this.innerHTML = "点我";
					}
				}
			}
		</script>

</html>